package com.wizard.moremall.project.controller;

import com.wizard.moremall.common.service.ICategoryService;
import com.wizard.moremall.common.vo.IndexCategoryVO;
import com.wizard.moremall.common.vo.IndexProductVO;
import com.wizard.moremall.common.vo.IndexTagVO;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2024-01-18
 */
@RestController
@RequestMapping("/category")
public class CategoryController {

    //依赖注入 common中的service类
    @Autowired ICategoryService categoryService;

    //首页二级分类列表
    @GetMapping("/list")
    @ResponseBody//只返数据
    public List<IndexCategoryVO> list() {
        return categoryService.indexList();
    }

    //首页顶部推荐商品
    @GetMapping("/top")
    @ResponseBody
    public List<IndexTagVO> top() {
        return categoryService.indexTop();
    }

}
